<template>
  <el-card>
    <itable :table="tconfig.tableConfig" :tableData="tconfig.tableData" :page-bean="tconfig.pageBean" @pageChange="pageChange">
      <template #searchBox>
        <ikechenform
          :model="form"
          :elem="fromData"
          :submit="true"
          :reset="true"
          :button="false"
          okIcon="Search"
          btnSize="small"
          submitText="搜索"
          @onSuccess="onSuccess"
          @onReset="clcikReset"
        />
      </template>
    </itable>
  </el-card>
</template>

<script setup lang='ts'>
import { reactive, ref } from 'vue';
import itable from '@/components/table/table.vue'
import { PageBean } from "@/utils/page-bean";
import ikechenform from "components/ITable/index.vue";

let fromData = reactive([
    {
      label: "操作人",
      prop: "value",
      clearable: true,
    },
    {
      element:'select',
      label: "日志类型",
      prop: "logType",
      option:[
        {label:'11',value:'1'}
      ],
      clearable: true,
    },
    {
      element:'select',
      label: "操作来源",
      prop: "operation",
      option:[
        {label:'11',value:'1'}
      ],
      clearable: true,
    },
    {
      element:'date',
      label: "操作时间",
      type:'datetimerange',
      prop: "time",
      clearable: true,
    },
])
let form = reactive({
  value:'',
  logType:'',
  operation:'',
  time:[
    new Date(2016, 9, 10, 8, 40),
    new Date(2016, 9, 10, 9, 40),
  ]
})
const tconfig = reactive({
  tableConfig: {} as {loading:boolean,[propName:string]:any},
  tableData: [] as any[],
  pageBean: new PageBean(10, 1, 0),
})
const clcikReset = () => {
  console.log('77')
}
const onSuccess = (form) => {
  console.log(form)
}
const pageChange = () => {

}

// 初始化表格
const initTable = () => {
  tconfig.tableConfig = {
    loading: false,
    hasSelect: false,
    hasIndex: true,
    hasOperation: false,
    hasSearch: true,
    hasPage: false,
    tr: [
      {
        label: "日志类型",
        minWidth: "140",
        prop: "currenttime",
      },
      {
        label: "操作人",
        minWidth: "110",
        prop: "costtime",
      },
      {
        label: "操作来源",
        minWidth: "160",
        prop: "onreason",
      },
      {
        label: "操作时间",
        minWidth: "100",
        prop: "watermeter",
      },
      {
        label: "IP",
        minWidth: "100",
        prop: "jurisdiction",
      },
      {
        label: "操作行为",
        minWidth: "100",
        prop: "jurisdiction",
      }
    ]
  }
}
initTable()
</script>

<style lang='scss' scoped>

</style>
